class BlogsController < FrontApplicationController


  def index
    @articles = Article.where(is_deleted: 0)
    @tags = Tag.where(is_deleted: 0)
    @categories = Category.joins(:article_categories).select('categories.id,max(categories.name) as name,count(distinct(article_categories.article_id)) as nums').group('categories.id')
  end

  def view
    @tags = Tag.where(is_deleted: 0)
    @categories = Category.joins(:article_categories).select('categories.id,max(categories.name) as name,count(distinct(article_categories.article_id)) as nums').group('categories.id')
    @article = Article.find(params[:id])
    @article.increment!(:browser_number)
  end


end